suppress errors on edit()

Hello,

 

When opening a module(visible) in edit mode how do you suppress the DOORS report stating "Unable to open module abc...." Thank you.

- Jim


EHcnck - Mon Jul 01 13:18:30 EDT 2013

Re: suppress errors on edit()
GregM_dxler - Mon Jul 01 15:58:39 EDT 2013

Will this work?

Module trg_mod = edit(Mod_Name, true)

if (null trg_mod) {

   halt //no error message

}

Greg

Re: suppress errors on edit()
llandale - Tue Jul 02 13:54:46 EDT 2013

If you mean suppress and edit error and prompt when someone else already has it open edit or share, then use the "silent" option:

  • mod = edit(Name, true, true)   // 2nd "true" means "silent"

I don't specifically recall any "unable to open ..." errors; but if I did I would do this to trap them:

  • noError()
  • mod = edit(Name, true, true)
  • string ErrMess = lastError()
  • if (!null ErrMess) then print "error opening '" Name "':  " ErrMess

This will trap run-time errors in Attr-DXL in the default loaded view; but I don't think traps Attr-DXL interpret errors (such as unreasolved #include reference)

-Louie

Re: suppress errors on edit()
EHcnck - Wed Jul 03 10:24:42 EDT 2013

llandale - Tue Jul 02 13:54:46 EDT 2013

If you mean suppress and edit error and prompt when someone else already has it open edit or share, then use the "silent" option:

  • mod = edit(Name, true, true)   // 2nd "true" means "silent"

I don't specifically recall any "unable to open ..." errors; but if I did I would do this to trap them:

  • noError()
  • mod = edit(Name, true, true)
  • string ErrMess = lastError()
  • if (!null ErrMess) then print "error opening '" Name "':  " ErrMess

This will trap run-time errors in Attr-DXL in the default loaded view; but I don't think traps Attr-DXL interpret errors (such as unreasolved #include reference)

-Louie

Hello,

The only way I found was to do the following:

    ...
    ...
    ...
    // Open Module.
    noError()
        Module m = edit(fullName(itm), false)
    string openStatus = lastError()
    
    // Print on error.
    if(!null openStatus) {
        logBuf << ((openStatus) "\n")
        return false
    }
    
    // Print on error.
    if (null m) {
        logBuf << (fullName(itm) ": [{Null} parameter]\n")
        return false
    }
    
    // Make sure "m" is visible for creating views.
    if(!isVisible(m)) {
        noError()
            edit(fullName(itm), true, false, true)
        string openStatus = lastError()
        
        // Print on error.
        if(!null openStatus) {
            logBuf << ((openStatus) "\n")
            return false
        }
        // Print on error.
        else if(!isVisible(m)) {
            logBuf << ((fullName(itm) " [Not Visible]") "\n")
            return false
        }
    }
    ...
    ...
    ...

Re: suppress errors on edit()
llandale - Mon Jul 08 14:55:07 EDT 2013

EHcnck - Wed Jul 03 10:24:42 EDT 2013

Hello,

The only way I found was to do the following:

    ...
    ...
    ...
    // Open Module.
    noError()
        Module m = edit(fullName(itm), false)
    string openStatus = lastError()
    
    // Print on error.
    if(!null openStatus) {
        logBuf << ((openStatus) "\n")
        return false
    }
    
    // Print on error.
    if (null m) {
        logBuf << (fullName(itm) ": [{Null} parameter]\n")
        return false
    }
    
    // Make sure "m" is visible for creating views.
    if(!isVisible(m)) {
        noError()
            edit(fullName(itm), true, false, true)
        string openStatus = lastError()
        
        // Print on error.
        if(!null openStatus) {
            logBuf << ((openStatus) "\n")
            return false
        }
        // Print on error.
        else if(!isVisible(m)) {
            logBuf << ((fullName(itm) " [Not Visible]") "\n")
            return false
        }
    }
    ...
    ...
    ...

You can indeed change views when the module is open only "read".